package com.fms.controller;

import com.fms.entity.Discard;
import com.fms.result.ResultData;
import com.fms.service.DiscardService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/discard")
@RequiredArgsConstructor
public class DiscardController {
    private final DiscardService discardService;

    @PostMapping("/addDiscard")
    private ResultData addDiscard(@RequestBody Discard discard){
        ResultData resultData = discardService.addDiscard(discard);
        return resultData;
    }

    @GetMapping("/getDiscards")
    private ResultData getDiscards(){
        ResultData resultData = discardService.getDiscards();
        return resultData;
    }

    @PostMapping("/deleteDiscard")
    private ResultData deleteDiscard(@RequestBody Discard discard){
        ResultData resultData = discardService.deleteDiscard(discard);
        return resultData;
    }

    @PostMapping("/commitDiscard")
    private ResultData commitDiscard(@RequestBody Discard discard){
        ResultData resultData = discardService.commitDiscard(discard);
        return resultData;
    }

    @PostMapping("/denyDiscard")
    private ResultData denyDiscard(@RequestBody Discard discard){
        ResultData resultData = discardService.denyDiscard(discard);
        return resultData;
    }
}
